
<?php

class UserModel{
    public $mysql;

    /*
         * 登录
         * 
         */
    public function select($where){
            include DOCUMENT_ROOT."/Framework/mysql.class.php";
        $this->mysql=new mysql();
        $this->mysql->db("user");
            $sql="select * from yonghu where $where";
            $arr= $this->mysql->select($sql);
            return $arr;
        }
        
        
// =============================================================================
    
        /*
         * 列表
         * 
         */
        public function liebiao(){
        include DOCUMENT_ROOT."/Framework/mysql.class.php";
        $this->mysql=new mysql();
        $this->mysql->db("luntan");
            $sql="select * from teizi";
            $arr= $this->mysql->select($sql);
            return $arr;
            
        }
// =============================================================================
        /*
         * 修改
         */
        public function xiugai($id){
            $sql="select * from yonghu where id=$id";
            $arr= $this->mysql->select($sql);
            return $arr;
        }
        
        public function XG($name,$pwd,$id){
        $sql="update yonghu set name= '$name',pwd = '$pwd' where id= $id";
        $arr = $this->mysql->update($sql);
        return $arr;
    }
    
 // =============================================================================   
    
      public function xiangqing($id){
        include DOCUMENT_ROOT."/Framework/mysql.class.php";
        $this->mysql=new mysql();
        $this->mysql->db("luntan");
        $sql="select * from teizi where id=$id";
        $arr= $this->mysql->select($sql);
      }
      
// ============================================================================= 
    public function fatie($biaoti,$wenzhang){
            include DOCUMENT_ROOT."/Framework/mysql.class.php";
            $this->mysql=new mysql();
            $this->mysql->db("luntan");
            $sql="insert into teizi (biaoti,wenzhang)values('$biaoti','$wenzhang')";
            $result=$this->mysql->insert($sql);
            return $result;
    }
    
   // =============================================================================  
        /*
         * 注册
         * 
         */
        
      public function ZCCX($where){//注册查询判断
        $sql="select * from yonghu where $where";
        $arr= $this->mysql->select($sql);
        if($arr=NULL){
            return true;
        }else{
            return false;
        }
        
    }
    public function adduser($name,$pwd){//注册insert into语句
        include DOCUMENT_ROOT."/Framework/mysql.class.php";
        $this->mysql=new mysql();
        $this->mysql->db("user");
            $sql="insert into yonghu (name,pwd)values('$name','$pwd')";
            $result=$this->mysql->insert($sql);
            echo $result;
        }   
}